import uuid
import datetime
from abc import ABCMeta, abstractmethod


class BaseRecord(metaclass=ABCMeta):
    @abstractmethod
    def create_record(self, **kwargs):
        """
        添加一条记录
        """
        pass

    @abstractmethod
    def get_record(self, record_id):
        """
        返回某条记录
        """
        pass

    @abstractmethod
    def get_record_detail(self, record_id):
        """
        返回某条记录的信息
        """
        pass

    @abstractmethod
    def edit_record(cls, record_id, **kwargs):
        """
        编辑记录
        """
        pass

    @abstractmethod
    def delete_record(cls, record_id):
        """
         删除记录
        """
        pass

    def create_base_info(cls):
        return {
            "uid": uuid.uuid1().hex,
            "create_time": datetime.datetime.now(),
            "is_delete": 0
        }

    @abstractmethod
    def filter_record(self, **kwargs):
        pass
